`formatPopulation.PostgreSQLConnection` <-
function(popdata, aggregate.by = NULL, subset=NULL, ...) {

# create sql command to transform data to long format


# do the aggregation
if(!is.null(aggregate)) {

}



# some R code to add age and sex variables


# return the aggregated data


}